import { Component, ViewChild } from '@angular/core';
import { Platform, Nav } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';

import { TabsPage } from '../pages/tabs/tabs';
import { environment } from "../environments/environment";
import { NewPage } from "../pages/new/New";
import { SearchPage } from "../pages/search/Search";


@Component({
  template: `<ion-nav [root]="rootPage"></ion-nav>`
})
export class MyApp {
  @ViewChild(Nav) public nav: Nav;
  public rootPage: any;
  private platform: Platform;
  public pages: Array<{ title: string, component: any }>;

  constructor(platform: Platform) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      console.log('production: ' + environment.production);

      this.platform = platform;
      this.rootPage = TabsPage;
      this.pages = [
        { title: '首页', component: TabsPage },
      ];
      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }
  public openPage(page: any): void {
    // close the menu when clicking a link from the menu
    // navigate to the new page if it is not the current page
    this.nav.setRoot(page.component);
  };
}
